/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package im.imrobots.v.xmpp;

import im.imrobots._comn.ASession;
import im.imrobots._face.IContact;
import im.imrobots._face.IMessage;
import im.imrobots._face.IMimeMessage;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.XMPPException;

/**
 *
 * @author yihaodian
 */
public class Session extends ASession
{
    Chat chat;

    @Override
    public void send()
    {
    }

    @Override
    public void send(String message)
    {
        try
        {
            chat.sendMessage(message);
        }
        catch (XMPPException ex)
        {
            Logger.getLogger(Session.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void send(IMessage message)
    {
        try
        {
            if (message instanceof Message)
            {
                chat.sendMessage(((Message) message).message);
            }
        }
        catch (XMPPException ex)
        {
            Logger.getLogger(Session.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void send(IMimeMessage message)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void send(File file)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public IContact getContact()
    {
        return null;
    }

    @Override
    public IMessage createMessage()
    {
        return new Message(new org.jivesoftware.smack.packet.Message());
    }

    @Override
    public IMimeMessage createMimeMessage()
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
